﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NeuralNetworkComponents
{
    public static class ConsolePrinter
    {
        [Flags] public enum OutputType {
            None = 0,
            Network = 1,
            Layers = 2,
            Weights = 4,
            All = 8
        }
        public static void PrintNetwork(ActivationNetwork network, OutputType ot)
        {
            if(ot.HasFlag(OutputType.All) || ot.HasFlag(OutputType.Network))
            {
                Console.WriteLine("Inputs: {0}", network.InputsCount);
                Console.WriteLine("Layers: {0}", network.LayersCount);
                Console.WriteLine("Outputs: {0}", network.Layers[network.LayersCount-1].NeuronsCount);
            }
            if (ot.HasFlag(OutputType.All) || ot.HasFlag(OutputType.Layers))
            {
                Console.Write("Inputs: ");
                for (int i = 0; i < network.InputsCount; i++)
                {
                    Console.Write("x, ");
                }
                Console.WriteLine();
                for (int l = 0; l < network.LayersCount; l++)
                {
                    Console.Write("Layer {0} ", l + 1);
                    for (int n = 0; n < network[l].NeuronsCount; n++)
                    {
                        Console.Write(network[l].Neurons[n].Output + ", ");
                    }
                    Console.WriteLine();
                }
            }
            if (ot.HasFlag(OutputType.All) || ot.HasFlag(OutputType.Weights))
            {
                for (int l = 0; l < network.LayersCount; l++)
                    for (int n = 0; n < network.Layers[l].NeuronsCount; n++)
                        for (int i = 0; i < network.Layers[l].Neurons[n].Weights.Length; i++)
                            Console.WriteLine("Neuron[{0}][{1}][{2}].Weight: {3}", l, n, i, network.Layers[l].Neurons[n].Weights[i]);
            }
        }
        public static void PrintBackPropagation()
        {
            ;
        }
    }
    
}